<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/page/util/include.jsp" %>
<link rel="stylesheet" type="text/css" href="../../ui/css/containers.css" />
<link rel="stylesheet" type="text/css" href="../../ui/css/base.css" />
<script type="text/javascript">
function ajaxStatusFun(productId){
	var statusId = ($("#productStatusId").html()=="下架")?1:0;
	var message=(statusId==1)?"您确定要下架吗？":"您确定要上架吗？";
	var flag = confirm(message);
	if(!flag){
		return;
	}
	$.ajax({
		type: "post", 
		url: "${pageContext.request.contextPath}/page/shop/updateProductStatus",
		data:{productId:productId,statusId:statusId},
		success:function(request){
			$("#productStatusId").html((statusId==1)?"上架":"下架");
		}
	});
}
</script>

   <div class="woRegion" style="width:993px; _margin-top:-12px;">
   <div class="woMenu_top">
      <div class="woMenu_topLeft"></div>
      <div class="woMenu_topMiddle" style="width:985px;">
        <div class="woMenu_topMiddle_Title">产品管理</div>
        <div class="woMenu_operation">
        <a href="${pageContext.request.contextPath}/page/shop/queryProductList">全部</a>|
        <a href="${pageContext.request.contextPath}/page/shop/queryProductList?statusId=0">已下架</a>|
        <a href="${pageContext.request.contextPath}/page/shop/queryOrderList">返回首页</a></div> 
      </div>
      <div class="woMenu_topRight"></div>
    </div>
    <div class="woMenu_middle2" style="width:989px;">
      <div class="productManageAdd">
      	<input type="button" value="添加产品" onclick="window.open('${pageContext.request.contextPath}/page/shop/preAddProductInfo', '_self ');" class="productAddBut" /></div>
      <div class="product_list">
      	<c:forEach items="${product_list}" var="tmp">
        <div class="product_list_one">
           <div class="productBg">
             <div class="product_pic"><a href="${pageContext.request.contextPath}/page/shop/queryProductInfo?productId=${tmp.productId}">
             	<img src="${pageContext.request.contextPath}/${tmp.imageZoomIn}" /></a>
             </div>
             <div><ul class="product_ul"> <li class="product_a">
             	<a href="${pageContext.request.contextPath}/page/shop/queryProductInfo?productId=${tmp.productId}">详情</a>
              </li><li class="product_a2">
             <c:if test="${tmp.statusId==1}">
               	<a id="productStatusId" onclick="ajaxStatusFun(${tmp.productId})" 
               		href="javascript:void(0);">上架</a>
                </c:if>
                <c:if test="${tmp.statusId==0}">
               	<a id="productStatusId" onclick="ajaxStatusFun(${tmp.productId})" 
               		href="javascript:void(0);">下架</a>
                </c:if>
             </li><li class="product_a">
             <a href="${pageContext.request.contextPath}/page/shop/preUpdateProductInfo?productId=${tmp.productId}">编辑</a>
             </li>
             </ul>
             </div>
           </div>
           <div class="product_name">
           <a href="${pageContext.request.contextPath}/page/shop/queryProductInfo?productId=${tmp.productId}">${tmp.productName}</a>
           </div>
        </div>
        </c:forEach>
      </div>
      
      <jsp:include page="../util/paging.jsp" flush="false">
      	<jsp:param name="sge" value="1"/>
      </jsp:include>
    </div>
  </div>